package com.example.kotlin01

import kotlin.reflect.KParameter


val maps = mapOf("name" to "小明", "age" to 12, "sex" to "男")

data class User(val name: String, val sex: String, val age: Int)


fun main() {
    maps.forEach{
        key,value->
    }
    maps.forEach { t, u ->  }
}
fun newThread() = Thread(object :Runnable{
    var count = 1
    override fun run() {
        //修改count的值
        count++
        println(count)
    }

})


class MyStatis {
    companion object MyTest:Runnable  {
        override fun run() {
            println("这是开启了一个线程")
        }
    }
}


interface ClickListener{
    fun click()
}

//私有的构造方法
private class MyFactor private constructor(val name: String) {
    companion object {
        fun instance(name:String) =MyFactor(name)
    }
}




class MyObject {
    //通过object关键字实现单例
    object SingleClass {
        val name = listOf(1, 2, 3)
        fun getSex() {
            println("性别")
        }
    }
}

